﻿using Dapper.FluentMap.Conventions;
using System.Text.RegularExpressions;

namespace Gmandarin.EntitiyMap.Dapper
{
    public class PropertyTransformConvention : Convention
    {
        public PropertyTransformConvention()
        {
            Properties()
                .Configure(c => c.Transform(s => {
                    return Regex.Replace(input: s, pattern: "([a-z])([A-Z])", replacement: "$1_$2").ToLower();
                    }
                ));
        }
    }
}
